import requests
import os
from goods_feedback.public.h5_header import *
from goods_feedback.config.setting import *
from goods_feedback.public.get_yaml import doYaml

rs=doYaml.get_data(os.path.join(data_path,'fileupload.yaml'))
based_url='{0}{1}'.format(h5_url,rs['path'])
method=rs['method']
file_path=rs['data']['file_path']
filename=rs['data']['filename']
file_data={'file':(filename,open(file_path,'rb'),'image/jpeg')}
headers=form_headers

def upload():
    re=requests.request(method,based_url,headers=headers,files=file_data).json()
    return re['data']

#upload()

